//
//  UIImage+Regular.h
//  动画
//
//  Created by edianzu on 2017/7/4.
//  Copyright © 2017年 edianzu. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIImage (Regular)

/***
 * 添加图片
 */
+ ( UIImage *)gw_drawImageWithImageNamed:(NSString *)name;

//给图片添加文字水印
+ (UIImage *)gw_waterImageWithImage:(UIImage *)image text:(NSString *)text textPoint:(CGPoint)point attributedString:(NSDictionary *)dictionary;

//给图片添加图片水印
+ (UIImage *)gw_waterImageWithImage:(UIImage *)image waterImage:(UIImage *)waterImage waterImageRect:(CGRect)rect;
//裁剪圆形图片
+ ( UIImage *)gw_ClipCircleImageWithImage:( UIImage *)image circleRect:(CGRect)rect;
//裁剪带边框的圆形图片
+ ( UIImage *)gw_ClipCircleImageWithImage:( UIImage *)image circleRect:(CGRect)rect borderWith:(CGFloat)borderWith borderColor:( UIColor *)borderColor;
// 截屏
+ (void)gw_cutScreenWithView:( UIView *)view successBlock:( void(^)(UIImage * image, NSData *  imageData))block;
//擦除效果
+ (UIImage *)gw_wipeImageWithView:( UIView *)view currentPoint:(CGPoint)nowPoint size:(CGSize)size;

/** 截取当前image对象rect区域内的图像 */
+ (UIImage *)gw_SubimageInrect:(UIImage *)image rect:(CGRect)rect;

/** UIView转化为UIImage */
+ (UIImage *)gw_imageFromView:(UIView *)view;

/** 压缩图片至指定尺寸 */
- (UIImage *)gw_rescaleImageToSize:(CGSize)size;

/** 在指定的size里面生成一个平铺的图片 */
- (UIImage *)gw_getTiledImageWithSize:(CGSize)size;

//////////////////////////// color //////////////////////
/** 根据颜色生成纯色图片 */
+ (UIImage *)imageWithColor:(UIColor *)color;

/** 取图片某一像素的颜色 */
- (UIColor *)colorAtPixel:(CGPoint)point;

/** 获得灰度图 */
- (UIImage *)convertToGrayImage;



///////////////////////// 设置图片的方向  旋转  //////////////////////////////////
/** 纠正图片的方向 */
- (UIImage *)fixOrientation;

/** 按给定的方向旋转图片 */
- (UIImage*)rotate:(UIImageOrientation)orient;

/** 垂直翻转 */
- (UIImage *)flipVertical;

/** 水平翻转 */
- (UIImage *)flipHorizontal;

/** 将图片旋转degrees角度 */
- (UIImage *)imageRotatedByDegrees:(CGFloat)degrees;

/** 将图片旋转radians弧度 */
- (UIImage *)imageRotatedByRadians:(CGFloat)radians;



//////////////////////////// 实现gif ///////////////////////////////////

/** 用一个Gif生成UIImage，传入一个GIFData */
+ (UIImage *)animatedImageWithAnimatedGIFData:(NSData *)theData;

/** 用一个Gif生成UIImage，传入一个GIF路径 */
+ (UIImage *)animatedImageWithAnimatedGIFURL:(NSURL *)theURL;


@end
